<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="css/reset.css" />
		<!-- <link rel="stylesheet" type="text/css" href="css/listGoods.css" /> -->
	</head>
	<body>
		<header></header>
		<section>
			
		</section>
		<footer id="footer"></footer>
	</body>
</html>
<script src="js/jQuery.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">

//内容主体区
 $("section").load("list.html");
 $.get("php/getGoodsList.php",{
 		"typeId":"001"
 	},function(resText,status,xhr){
 		resText=JSON.parse(resText);
 			$(".total").html("共"+resText.length+"个产品");
 		// console.log(resText.length);
		if(resText.length==0){
		$("section .products").html("sorry,");
		}
		// let widthlen;
		// if(resText.length%4!=0){
		// 	widthlen=(resText.length/4+1)*360;
		// 	$("section").css("height",widthlen);
		// }else{
		// 	widthlen=(resText.length/4)*360;
		// 	$("section").css("height",widthlen);
		// }
 		console.log();
 		  let fu=document.querySelector(".products");
 		// let newLi=$(".products");
 		// src="${resText[i].goodsImg}" 
 		for(let i=0;i<resText.length;i++){
 			// let imgsrc=resText[i].goodsImg.slice(23,resText[0].goodsImg.length);
 			let newLi=document.createElement("li");
 			newLi.innerHTML=`<li >
 					<a href="details.html?goodsId=${resText[i].goodsId}">
 						<div class="prolistImg">
 						<div class="jiaobiao">${resText[i].goodsId}</div>
 							<img alt="" loading="lazy" src="${resText[i].goodsImg}" />
 							</div>
 						<p title="${resText[i].beiyong1}">${resText[i].beiyong1}</p>
 						<span>¥ ${resText[i].goodsPrice}</span>
 					</a>
 				</li>`;
 			fu.appendChild(newLi);
 			// let x=document.querySelectorAll(".jiaobiao");
 			// console.log(x[0],x[1]);
 		}
 	})	
	
</script>
